import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  BaseEntity,
  Index,
  OneToMany,
  OneToOne,
  JoinColumn,
} from 'typeorm';
import RoleEntity from './role.entity';
@Entity('role_menu')
export default class RoleMenuEntity extends BaseEntity {
  @PrimaryGeneratedColumn('increment', { type: 'bigint', comment: 'id编号' })
  id: number;

  @Column({ nullable: true, comment: '菜单名称' })
  name: string;

  // 0 管理员 1 普通用户 2 访客
  @Column({ comment: '菜单属性' })
  value: number;

  // 父菜单id
  @OneToOne(type => RoleMenuEntity)
  @JoinColumn({ name: 'parentId' })
  parent: number;
}
